# -*-perl-*-
{
    %PERL_FILE_FLAGS =
	(baddirect => q(-I.),
	 badinit => q(-I.),
	 badrole => q(-I.),
	 badwrt1 => q(-I.),
	 badwrt2 => q(-I.),
	 badwrt3 => q(-I.),
	 badwrt4 => q(-I.),
	 html => q(-I.),
	 writer => q(-I.),
	 mathml01 => q(-I.),
	 );

    %PREST_FILE_FLAGS =
	(indtarget => q(-D xformoff='Decorations'),
	 badwrt1 => q(-w bad1),
	 badwrt2 => q(-w bad2),
	 badwrt3 => q(-w bad3),
	 badwrt4 => q(-w bad4),
	 dom => q(-D trusted),
	 html => q(-D generator=0),
	 image01 => q(-D image-exts=.fig=.png,.abc=.gif),
	 nowrt => q(-w nosuchwriter),
	 restructured => q(-D xformoff='Decorations'),
	 transforms => q(-D xformoff='Decorations'),
	 pending => q(-d -D xformoff='Decorations'),
	 writer => q(-w cover -D no_line_directives),
	 );

    # Don't define "-W nobackn"
    $PREST_WRT_FLAGS{dom} = '';
}

test:	{ sort @OKS, qw(writer_direct.ok) }

writer_direct.txt.out:
	{
	    BEGIN {
		eval "use Devel::Cover qw(-db ../../cover_db -silent 1
                              -summary 0 +ignore .*smak
				)"
			      if $ENV{COVER};
	    }
	    my($maker, $target) = @_;
	    use vars qw($LIB);
	    eval 'use lib $LIB; use Text::Restructured::DOM;';
	    use Text::Restructured::Writer;
	    my $writer = Text::Restructured::Writer->new(dom => {});
	    open OUT, ">$target";
	    printf OUT "%s\n", join(' ',sort keys %{$writer->{opt}});
	    close OUT;
	}

# The following is not used, but illustrates a proof of concept
dom_direct.ok:
	{
	    my($maker, $target) = @_;
	    use vars qw($LIB);
	    eval 'use lib $LIB; use Text::Restructured::DOM;';
	    my $d1 = Text::Restructured::DOM->new('literal_block');
	    my $d2 = Text::Restructured::DOM->new('literal');
	    my %tests =
		('$d1->is_body_elt'       => 1,
		 '$d1->is_inline_elt'     => 0,
		 '$d1->takes_inline_elts' => 1,
		 '$d2->is_body_elt'       => 0,
		 '$d2->is_inline_elt'     => 1,
		 '$d2->takes_inline_elts' => 0,
		 );
	    my @mismatches;
	    foreach (sort keys %tests) {
		push @mismatches, "Failed $_" unless eval($_) == $tests{$_};
		push @mismatches, "$_: $@" if $@;
	    }
	    open T, ">$target" or die "Cannot write $target";
	    print T @mismatches;
	    close T;
	}
